/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package se.kth.lwr.jeat.core;

import java.io.File;
import java.util.*;
import javax.swing.SwingWorker;

/** An EmissionCatgory represents a specific type of Emission, such as Cd, CO2 etc.
 * EmissionCategories also holds a reference to all existing EmissionCategories,
 * which can be acquired by the method <code>getCategories()</code>. There is a
 * standard set of EmmissionCategories that are statically available from this 
 * class. However it is easy to expand the set of standard Categories:
 * 
 * ??? Finns det någon anledning att göra dessa klasser abstracta?
 * <p/>
 * Example:
 * <p/>
 * <pre>
 * <code>
 * EmissionCategory mySpecialCategory=new EmissionCategory(
 * "Special emission", 
 * "Very dangerous"){};
 * </code>
 * </pre>
 * <p/>
 * It is recommended to collect the extended EmmissionCategories in a separate 
 * class for easy access like so:
 * <p/>
 * <pre>
 * <code> 
 * class myEmissions{
 *
 *      public static final EmissionCategory A=new EmissionCategory(
 *      "A",
 *      "description of A"){};
 *
 *      public static final EmissionCategory B=new EmissionCategory(
 *      "B",
 *      "description of B"){};
 * 
 *      Public static final ... etc
 * 
 * }
 * </code>
 * </pre>
 *
 *@author david
 */
public abstract class EmissionCategory extends Category<EmissionCategory> {

    /**
     * A reference to all defined EmissionCatgeories. Elements are ordered 
     * according to the Natural order of the objects
     */
    private static Set<EmissionCategory> categories = new TreeSet<>();
    
    /**
     * Creates a new EmissionCategory.
     * 
     * @param name name of the category
     * @param description  description of category
     */
    public EmissionCategory(String name, String description) {
        super(name, description);
        categories.add(this);
    }

    /**
     * Jag har läst att man bör returnera generella objectreferenser. Förstår inte
     * riktigt vitsen förutom att man då inte tar ställning till hur objektet skall 
     * användas.      
     * 
     * @return a Set of all defined EmissionCategories 
     */
    @Override
    public final Set<EmissionCategory> getCategories() {
        return Collections.unmodifiableSet(categories);
    }

   
    //Standard implementations goes here
    /**
     * PO4, Phosphate
     */
    public static final EmissionCategory PO4 = new EmissionCategory("PO4", "Phosphate") {
    };
    /**
     * CO2, Carbon dioxide 
     */
    public static final EmissionCategory CO2 = new EmissionCategory("CO2", "Carbon dioxide") {
    };
    /**
     * N, Nitrogen
     */
    public static final EmissionCategory N = new EmissionCategory("N", "Nitrogen") {
    };
    
    /**
     * CO2, Carbon monoxide 
     */
    public static final EmissionCategory CO= new EmissionCategory("CO", "Carbon monoxide") {};
    /**
     * NO, Nitric oxide
     */
    public static final EmissionCategory NOx=new EmissionCategory("NO", "Nitric oxide") {};
    
    /**
     * CH4, Methane
     */
    public static final EmissionCategory CH4= new EmissionCategory("NH4", "Methane") {};
    
    /**
     * HFC-23, Fluoroform
     */
    public static final EmissionCategory HFC23= new EmissionCategory("HFC23", "HFC-23, hydrofluorocarbon") {};
    
    /**
     * HFC-134a, Haloalkane refrigerant
     */
    public static final EmissionCategory HFC134a= new EmissionCategory("HFC134a", "HFC-134a, Haloalkane refrigerant") {};

    /**
     * SF6, Sulfur hexafluoride
     */
    public static final EmissionCategory SF6= new EmissionCategory("SF6", "SF6, Sulfur hexafluoride") {};
    
    /**
     * N2O, Nitrous oxide
     */
    public static final EmissionCategory N2O= new EmissionCategory("N2O", "N2O, Nitrous oxide") {};
    
    /**
     * P, Total phosphorus
     */
    
    public static final EmissionCategory P=new EmissionCategory("P", "Total phosphorus") {};
    
    /**
     * BOD7, Biological oxygen demand 7 days
     */
    public static final EmissionCategory BOD7=new EmissionCategory("BOD7", "Biological oxygen demand (7 days)") {};
    

}
